<?php
function rc_geo_country($ob_pos, $md) {

    $GeoCountries = "SELECT pai_CodElite AS ID, pai_NombreESP AS NAME
								FROM hd_paises
								WHERE pai_ActivoGiros = 1
								ORDER BY NAME ASC";
    if ($md == 'RD') {
        $Label = $GLOBALS['MYT']->db_array("SELECT pai_NombreESP AS NAME FROM hd_paises
								WHERE pai_CodElite = {$ob_pos}");
        $Label = $Label[1]['NAME'];
    } else {
        $Label = ' ';
    }

    mn_field('select', $md, 'BnfPais', $ob_pos, $GeoCountries, $Label, 'False', '"
	onChange="document.ReceiverProperties.action=\'_response/call.php?get=Geo/geos\';
	subform(\'ReceiverProperties\',\'GeoR\');
	document.ReceiverProperties.action=\'_response/call.php?get=Operative/view/viewreceiverdocument\';
	subform(\'ReceiverProperties\',\'DocVal\');
	');
}

function rc_geo_prov($ob_pos1, $ob_pos2, $md) {

    $GeoProv = "SELECT geor.Prov_ID AS ID,
		geor.Prov_Provincia AS NAME
	FROM cp_provincias AS geor
	WHERE Prov_Pais = {$ob_pos1}
	ORDER BY NAME ASC";
    if ($md == 'RD') {
        $Label = $GLOBALS['MYT']->db_array("SELECT geor.Prov_Provincia AS NAME
		FROM cp_provincias AS geor
		WHERE geor.Prov_ID = {$ob_pos2}");
        $Label = $Label[1]['NAME'];
    } else {
        $Label = ' ';
    }

    mn_field('select', $md, 'BnfProvincia', $ob_pos2, $GeoProv, $Label, 'False', '"
	onChange="document.ReceiverProperties.action=\'_response/call.php?get=Geo/geos\';
	subform(\'ReceiverProperties\',\'GeoR\');
	document.ReceiverProperties.action=\'_response/call.php?get=Operative/view/viewreceiverdocument\';
	subform(\'ReceiverProperties\',\'DocVal\');
	');
}

function rc_geo_city($ob_pos1, $ob_pos2, $ob_pos3, $md) {

    $GeoCity = "SELECT CiuNumero AS ID, CiuCiudad AS NAME
			FROM ciudades
			WHERE CiuPais = {$ob_pos1} AND Prov_ID = {$ob_pos2}
			ORDER BY NAME ASC";
    if ($md == 'RD') {
        $Label = $GLOBALS['MYT']->db_array("SELECT CiuCiudad AS NAME
		FROM ciudades
		WHERE CiuNumero = {$ob_pos3}");
        $Label = $Label[1]['NAME'];
    } else {
        $Label = ' ';
    }

    mn_field('select', $md, 'BnfCiudad', $ob_pos3, $GeoCity, $Label, 'False', '"
	onChange="document.ReceiverProperties.action=\'_response/call.php?get=Geo/geos\';
	subform(\'ReceiverProperties\',\'GeoR\');
	document.ReceiverProperties.action=\'_response/call.php?get=Operative/view/viewreceiverdocument\';
	subform(\'ReceiverProperties\',\'DocVal\');
	');
}
?>
